package com.centerm.common.constant.enums.project;

import com.centerm.common.constant.StatusCode;

/**
 * 里程碑中每个负责人的状态
 * @ClassName SubMilestoneStatus
 * @Description: 
 * @author czy
 * @date 2017年9月8日
 */
public enum SubMilestoneStatus implements StatusCode {
    
    UNFINISH(0, "未启动"),
    RUNNING(1, "执行中"),
    FINISH(2, "完成");

    private Integer code;
    private String description;
    
    private SubMilestoneStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getDescription() {
        return this.description;
    }

    public static SubMilestoneStatus getByCode(Integer code) {
        for(SubMilestoneStatus status : SubMilestoneStatus.values()) {
            if(status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }


    public static String getDescriptionByCode(Integer code) {
        for(SubMilestoneStatus status : SubMilestoneStatus.values()) {
            if(status.getCode().equals(code)) {
                return status.getDescription();
            }
        }
        return null;
    }
}
